﻿Type=StaticCode
Version=5.8
ModulesStructureVersion=1
B4A=true
@EndOfDesignText@
'Code module
'Subs in this code module will be accessible from all modules.
Sub Process_Globals
	'These global variables will be declared once when the application starts.
	'These variables can be accessed from all modules.

End Sub
Sub CreatePageIndicator(numberOfPages As Int, inactiveBitmap As Bitmap, Width As Int, Height As Int) As Panel
	Dim imageSize, maxWidth, Gap, Top As Int
	
	maxWidth = Width / numberOfPages
	If maxWidth < Height Then
		imageSize = maxWidth
		Top = (Height - maxWidth) / 2
		Gap = 0
	Else
		imageSize = Height
		Top = 0
		Gap = (Width - numberOfPages * imageSize) / (numberOfPages - 1)
	End If
	
	Dim basePanel As Panel
	
	basePanel.Initialize("")
	For i = 0 To numberOfPages - 1
		Dim iv As ImageView
		
		iv.Initialize("")
		iv.Gravity=Gravity.FILL
		iv.Bitmap = inactiveBitmap
		basePanel.AddView(iv, i * (imageSize + Gap), Top, imageSize, imageSize)
	Next
	
	Return basePanel
End Sub

Sub SetPageIndicator(pagePanel As Panel, page As Int, activeBitmap As Bitmap, inactiveBitmap As Bitmap)
	Dim v As View
	Dim iv As ImageView

	For i = 0 To pagePanel.NumberOfViews - 1
		v = pagePanel.GetView(i)
		If v Is ImageView Then
			iv = v
			If i = page Then
				iv.Bitmap = activeBitmap
			Else
				iv.Bitmap = inactiveBitmap
			End If
		End If
	Next
End Sub